

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/reset.css">
    <link rel="stylesheet" type="text/css" href="css/layer.css">
    <link rel="stylesheet" type="text/css" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <script src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
    <script src="js/layer.js"></script>
    <script src="js/swiper.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
</head>
<body>
  	<div class="nav"></div>
	<div class="film-list top125">
		<div class="film-list-tab">
			<ul class="clearfix">
				<li>
					<a href="javascript:;"  class="tab-active" data-value="00">最近更新</a>
				</li>
				<li>
					<a href="javascript:;" data-value="01">最近热播</a>
				</li>
			</ul>
		</div>
		<div class="film-list-tab2">
			<ul class="clearfix">
				<li class="tab2-active" data-value="">
					全部
				</li>

			</ul>
		</div>
		<div class="film-list-tab3">
			<ul class="clearfix">
				<li class="tab3-active" data-value="">
					全部
				</li>
			</ul>
		</div>
		<div class="list">
	        <ul>
	          
	        </ul>
            <div class="click-more">点击加载更多</div>
        </div>
	</div>
  </div>
  <div class="search-box searchide"></div>
	<script type="text/javascript">
	$(function(){
        // 视频筛选列表
        var area = '';
        var type = '';
        var name = '';
        var pageNum = 1;
        var pageSize = 15;
        var sort = '00';
        var clickMore ='2';
		$(".film-list-tab ul li a").on("click",function(){
			$(".film-list-tab ul li a").removeClass("tab-active");
			$(this).addClass("tab-active");
			sort = $(this).attr("data-value");
            clickMore ='2';
            pageNum = 1;
            pageSize = 15;
			search(area,type,name,pageNum,pageSize,sort,clickMore);
		})
		// 选项卡
		$.ajax({
            url: window.baseUrl+'api/movie/movieClassify',
            type: 'get',
            contentType: false,
            processData: false,
            success: function (data) {
                if(data.code == 200){
                	var areas = data.datas.areas;
                	var typeTab = data.datas.type;
                	var areasStr = '';
                	var typeStr = '';
                	for(var i = 0;i<areas.length;i++){
                		areasStr = areasStr+'<li data-value="'+areas[i].value+'">'+areas[i].caption+'</li>'
                	}
              		for(var j = 0;j<typeTab.length;j++){
                		typeStr = typeStr+'<li data-value="'+typeTab[j].value+'">'+typeTab[j].caption+'</li>'
                	}
                	$(".film-list-tab2 ul").append(areasStr);
                	$(".film-list-tab3 ul").append(typeStr);
                	// 地区选项
					$(".film-list-tab2 ul li").on("click",function(){
						$(".film-list-tab2 ul li").removeClass("tab2-active");
						$(this).addClass("tab2-active");
						area = $(this).attr("data-value");
                        clickMore ='2';
                        pageNum = 1;
                        pageSize = 15;
						search(area,type,name,pageNum,pageSize,sort,clickMore);
					})
					// 类型选项
					$(".film-list-tab3 ul li").on("click",function(){
						$(".film-list-tab3 ul li").removeClass("tab3-active");
						$(this).addClass("tab3-active");
						type = $(this).attr("data-value");
                        clickMore ='2';
                        pageNum = 1;
                        pageSize = 15;
						search(area,type,name,pageNum,pageSize,sort,clickMore);
					})
                }
            }
        });
        search(area,type,name,pageNum,pageSize,sort,clickMore);
        function search(area,type,name,pageNum,pageSize,sort,clickMore){
        	$.ajax({
                url: window.baseUrl+'api/movie/list',
                type: 'POST',
                data: {
                	area:area,
                	type:type,
                	name:name,
                	pageNum:pageNum,
                	pageSize:pageSize,
                	sort:sort
                },
                success: function (data) {
                    var searchListStr = '';
                    if(data.datas.pages != 0){
                        if(data.datas.result.length == 15){
                            $(".click-more").show()
                        }else{
                            $(".click-more").hide()
                        }
                        for(var i = 0;i<data.datas.result.length;i++){
                            if(data.datas.result[i].tag == ''){
                                var setTag = ''
                            }else{
                                var setTag = '<div class="hot"><span>'+data.datas.result[i].tag+'</span></div>'
                            }
                            searchListStr = searchListStr + '<li><div class="piclist-img">';
                            searchListStr = searchListStr + '<a href="detail.html?id='+data.datas.result[i].id+'" >';
                            searchListStr = searchListStr + '<img src="'+data.datas.result[i].logo+'" alt="">';
                            searchListStr = searchListStr + '<div class="definition">'+data.datas.result[i].clarity+'</div>';
                            searchListStr = searchListStr + setTag +'</a></div>';
                            searchListStr = searchListStr + '<div class="piclist-title">'+data.datas.result[i].movieName+'</div>';
                            searchListStr = searchListStr + '</li>';
                        }
                        if(clickMore == '1'){
                            $(".film-list .list ul").append(searchListStr)
                        }else{
                            $(".film-list .list ul").html(searchListStr)
                        }
                    }else{
                        $(".click-more").hide()
                        $(".film-list .list ul").html(searchListStr)
                    }
                }
            });
        }
        $(".click-more").on("click",function(){
            pageNum = pageNum+1;
            clickMore = '1';
            search(area,type,name,pageNum,pageSize,sort,clickMore);
        })

	})
	</script>
</body>
</html>